net: fec_mxc: Fix timeouts during tftp transfer
authorFabio Estevam <[email protected]>
Wed, 18 Sep 2013 02:13:10 +0000 (23:13 -0300)
committerStefano Babic <[email protected]>
Fri, 20 Sep 2013 15:55:37 +0000 (17:55 +0200)
Performing tftp transfers on mx28 results in random timeouts.

Hector Palacios and Robert Hodaszi analyzed the root cause being related to the
wrong alignment of the 'buff' buffer inside fec_recv().

Benoît Thébaudeau provided an excellent analysis of the alignment bug that is
present on older versions, such as GCC 4.5.4:

http://marc.info/?l=u-boot&m=137942904906131&w=2

Use ALLOC_CACHE_ALIGN_BUFFER() to avoid alignment issues from older GCC
versions.

Reported-by: Hector Palacios <[email protected]>
Tested-by: Oliver Metz <[email protected]>
Tested-by: Hector Palacios <[email protected]>
Signed-off-by: Fabio Estevam <[email protected]>
Acked-by: Marek Vasut <[email protected]>
Tested-by: Marek Vasut <[email protected]>
drivers/net/fec_mxc.c

index 210ef02df53dbf9ba332e91c3b428b981807342d..107cd6ecc5c3b25a5b173faba25f1e2f76b26b50 100644 (file)
@@ -794,7 +794,7 @@ static int fec_recv(struct eth_device *dev)
        uint16_t bd_status;
        uint32_t addr, size, end;
        int i;
-       uchar buff[FEC_MAX_PKT_SIZE] __aligned(ARCH_DMA_MINALIGN);
+       ALLOC_CACHE_ALIGN_BUFFER(uchar, buff, FEC_MAX_PKT_SIZE);
 
        /*
         * Check if any critical events have happened